/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
 */

import { createFileDecorator, createBaseDecorator } from './factory.js';
import { IncrementalDecoratorType } from './types.js';

/**
 * 增量输入声明装饰器，用于声明外部的增量输入：字面量、对象、数组，示例：
 * class A extends IncrementalTask {
 *   @Input()
 *   private boolean isSucceed;
 *
 *   @Input()
 *   private get useBabel() {
 *     return !!this.targetService.getBuildOptions().strict?.useBabel
 *   }
 * }
 */
export const Input = createBaseDecorator(IncrementalDecoratorType.Input);

/**
 * 增量输入声明装饰器，用于声明外部的增量输入，仅支持Map：
 * class A extends IncrementalTask {
 *   @Inputs()
 *   private Map<string, TaskInputValue> = new Map();
 *
 * }
 */
export const Inputs = createBaseDecorator(IncrementalDecoratorType.Inputs);

/**
 * 增量输入声明装饰器，用于声明外部的增量输入：文件/文件夹路径，示例：
 * class A extends IncrementalTask {
 *   @InputFile({ isDirectory: false })
 *   private string jsonPath = '/a/b.json';
 *
 *   @InputFile({ isDirectory: false })
 *   private get ohPackageJsonPath() {
 *     return '/a/b.json';
 *   }
 * }
 */
export const InputFile = createFileDecorator(IncrementalDecoratorType.InputFile);

/**
 * 增量输入声明装饰器，用于声明外部的增量输入：文件/文件夹路径数组，示例：
 * class A extends IncrementalTask {
 *   @InputFiles({ isDirectory: false })
 *   private string jsonPaths = ['/a/b.json'];
 *
 *   @InputFiles({ isDirectory: false })
 *   private get ohPackageJsonPath() {
 *     return ['/a/b.json'];
 *   }
 * }
 */
export const InputFiles = createFileDecorator(IncrementalDecoratorType.InputFiles);

/**
 * 增量输出声明装饰器，用于声明任务的输出：文件/文件夹路径，示例：
 * class A extends IncrementalTask {
 *   @OutputFile({ isDirectory: false })
 *   private string jsonPaths = '/a/b.json';
 *
 *   @OutputFile({ isDirectory: false })
 *   private get ohPackageJsonPath() {
 *     return '/a/b.json';
 *   }
 * }
 */
export const OutputFile = createFileDecorator(IncrementalDecoratorType.OutputFile);

/**
 * 增量输出声明装饰器，用于声明任务的输出：文件/文件夹路径数组，示例：
 * class A extends IncrementalTask {
 *   @OutputFiles({ isDirectory: false })
 *   private string jsonPaths = ['/a/b.json'];
 *
 *   @OutputFile({ isDirectory: false })
 *   private get ohPackageJsonPath() {
 *     return ['/a/b.json'];
 *   }
 * }
 */
export const OutputFiles = createFileDecorator(IncrementalDecoratorType.OutputFiles);

/**
 * 用于装饰 declareInputs、declareOutputFiles、declareInputFiles
 * 如果使用了该装饰器，也就是告知了hvigor，增量输入/输出只收集到当前对象，不再向上收集
 */
export const IgnoreSuperIncremental = createBaseDecorator(IncrementalDecoratorType.IgnoreSuperIncremental);
